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mb3JtYXRpb24uIiwKICAgICAgICAgICAgQlIoKQogICAgICAgICksCiAgICAgICAgQlIoKQogICAgKTsKfTsKCkludGVycHJldGVyTWFuYWdlci5wcm90b3R5cGUuc3VibWl0ID0gZnVuY3Rpb24gKGV2ZW50KSB7CiAgICBpZiAodGhpcy5ibG9ja2luZ09uKSB7CiAgICAgICAgdHJ5IHsKICAgICAgICAgICAgdGhpcy5ibG9ja2luZ09uLmNhbmNlbCgpOwogICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgdGhpcy5zaG93RXJyb3IoZSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuYmxvY2tpbmdPbiA9IG51bGw7CiAgICB9CiAgICB0aGlzLmRvU3VibWl0KCk7CiAgICB0aGlzLmRvU2Nyb2xsKCk7CiAgICBldmVudC5zdG9wKCk7Cn07CgpJbnRlcnByZXRlck1hbmFnZXIucHJvdG90eXBlLmhlbHAgPSBmdW5jdGlvbiAoZm4pIHsKICAgIGlmIChmbiAmJiBmbi5OQU1FKSB7CiAgICAgICAgZm4gPSBmbi5OQU1FOwogICAgfQogICAgaWYgKHR5cGVvZihmbikgIT0gInN0cmluZyIgfHwgZm4ubGVuZ3RoID09IDApIHsKICAgICAgICB3cml0ZWxuKCJoZWxwKGZ1bmMpIG9uIGFueSBNb2NoaUtpdCBmdW5jdGlvbiBmb3IgaGVscCIpOwogICAgICAgIHJldHVybjsKICAgIH0KICAgIHZhciBjb21wcyA9IGZuLnNwbGl0KCcuJyk7CiAgICB2YXIgYmFzZSA9IGNvbXBzLnNwbGljZSgwLCAyKTsKICAgIHZhciBzaG9ydGZuID0gY29tcHMuam9pbignLicpOwogICAgdmFyIHVybCA9ICcuLi8uLi9kb2MvaHRtbC8nICsgYmFzZS5qb2luKCcvJykgKyAnLmh0bWwnOwogICAgdmFyIGQgPSBkb1hIUih1cmwsIHttaW1lVHlwZTogJ3RleHQveG1sJ30pOwogICAgZC5hZGRDYWxsYmFjayhmdW5jdGlvbiAocmVxKSB7CiAgICAgICAgdmFyIGVscyA9IGdldEVsZW1lbnRzQnlUYWdBbmRDbGFzc05hbWUoCiAgICAgICAgICAgICdhJywgJ21vY2hpZGVmJywgcmVxLnJlc3BvbnNlWE1MKTsKICAgICAgICB2YXIgbWF0Y2ggPSAnI2ZuLScgKyBzaG9ydGZuLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBlbHMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgdmFyIGVsZW0gPSBlbHNbaV07CiAgICAgICAgICAgIHZhciBocmVmID0gZWxlbS5ocmVmOwogICAgICAgICAgICB2YXIgaWR4ID0gaHJlZi5pbmRleE9mKCcjJyk7CiAgICAgICAgICAgIGlmIChpZHggIT0gLTEgJiYgaHJlZi5zdWJzdHJpbmcoaWR4KSA9PSBtYXRjaCkgewogICAgICAgICAgICAgICAgd3JpdGVsbihBKHtocmVmOiB1cmwgKyBtYXRjaCwgdGFyZ2V0OiAnX2JsYW5rJ30sCiAgICAgICAgICAgICAgICAgICAgc2NyYXBlVGV4dChlbGVtKSkpOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHdyaXRlbG4oJ2RvY3VtZW50YXRpb24gZm9yICcgKyBmbiArICcgbm90IGZvdW5kJyk7CiAgICB9KTsKICAgIGJsb2NrT24oZCk7Cn07CgoKSW50ZXJwcmV0ZXJNYW5hZ2VyLnByb3RvdHlwZS5kb1Njcm9sbCA9IGZ1bmN0aW9uICgpIHsKICAgIHZhciBwID0gZ2V0RWxlbWVudCgiaW50ZXJwcmV0ZXJfb3V0cHV0IikubGFzdENoaWxkOwogICAgaWYgKHR5cGVvZihwKSA9PSAidW5kZWZpbmVkIiB8fCBwID09IG51bGwpIHsKICAgICAgICByZXR1cm47CiAgICB9CiAgICB2YXIgYXJlYSA9IGdldEVsZW1lbnQoImludGVycHJldGVyX2FyZWEiKTsKICAgIGlmIChhc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lwZS5zaG93RXJyb3IgPSBmdW5jdGlvbiAoZSkgewogICAgaWYgKHR5cGVvZihlKSAhPSAib2JqZWN0IikgewogICAgICAgIGUgPSBuZXcgRXJyb3IoZSk7CiAgICB9CiAgICBhcHBlbmRDaGlsZE5vZGVzKCJpbnRlcnByZXRlcl9vdXRwdXQiLAogICAgICAgIFNQQU4oeyJjbGFzcyI6ICJlcnJvciJ9LCAiRXJyb3I6IiksCiAgICAgICAgVEFCTEUoeyJjbGFzcyI6ICJlcnJvciJ9LAogICAgICAgICAgICBUSEVBRCh7ImNsYXNzIjogImludmlzaWJsZSJ9LCBURCh7ImNvbHNwYW4iOiAyfSkpLAogICAgICAgICAgICBURk9PVCh7ImNsYXNzIjogImludmlzaWJsZSJ9LCBURCh7ImNvbHNwYW4iOiAyfSkpLAogICAgICAgICAgICBUQk9EWShudWxsLAogICAgICAgICAgICAgICAgbWFwKGZ1bmN0aW9uIChrdikgewogICAgICAgICAgICAgICAgICAgIHZhciB2ID0ga3ZbMV07CiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZih2KSA9PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZih2KSA9PSAib2JqZWN0IikgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gcmVwcih2KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRSKG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIFREKHsiY2xhc3MiOiAiZXJyb3IifSwga3ZbMF0pLAogICAgICAgICAgICAgICAgICAgICAgICBURCh7ImNsYXNzIjogImRhdGEifSwgdikKICAgICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgfSwgc29ydGVkKGl0ZW1zKGUpKSkKICAgICAgICAgICAgKQogICAgICAgICkKICAgICk7CiAgICB3aW5kb3cubG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ym1pdCA9IGZ1bmN0aW9uICgpIHsKICAgIHZhciBlbGVtID0gZ2V0RWxlbWVudCgiaW50ZXJwcmV0ZXJfdGV4dCIpOwogICAgdmFyIGNvZGUgPSBlbGVtLnZhbHVlOwogICAgZWxlbS52YWx1ZSA9ICIiOwogICAgdmFyIGlzQ29udGludWF0aW9uID0gZmFsc2U7CiAgICBpZiAoY29kZS5sZW5ndGggPj0gMiAmJiBjb2RlLmxhc3RJbmRleE9mKCIvLyIpID09IGNvZGUubGVuZ3RoIC0gMikgewogICAgICAgIGlzQ29udGludWF0aW9uID0gdHJ1ZTsKICAgICAgICBjb2RlID0gY29kZS5zdWJzdHIoMCwgY29kZS5sZW5ndGggLSAyKTsKICAgIH0KICAgIGFwcGVuZENoaWxkTm9kZXMoImludGVycHJldGVyX291dHB1dCIsCiAgICAgICAgU1BBTih7ImNsYXNzIjogImNvZGUifSwgIj4+PiAiLCBjb2RlKSwKICAgICAgICBCUigpCiAgICApOwogICAgdGhpcy5saW5lcy5wdXNoKGNvZGUpOwogICAgdGhpcy5oaXN0b3J5LnB1c2goY29kZSk7CiAgICB0aGlzLmhpc3RvcnlQb3MgPSAtMTsKICAgIHRoaXMuY3VycmVudEhpc3RvcnkgPSAiIjsKICAgIGlmIChpc0NvbnRpbnVhdGlvbikgewogICAgICAgIHJldHVybjsKICAgIH0KICAgIHZhciBhbGxDb2RlID0gdGhpcy5saW5lcy5qb2luKCJcbiIpOwogICAgdGhpcy5saW5lcyA9IFtdOwogICAgdGhpcy5ydW5Db2RlKGFsbENvZGUpOwogICAgcmV0dXJuOwp9OwoKSW50ZXJwcmV0ZXJNYW5hZ2VyLnByb3RvdHlwZS5ydW5Db2RlID0gZnVuY3Rpb24gKGFsbENvZGUpIHsKICAgIHZhciByZXM7CiAgICB0cnkgewogICAgICAgIHJlcyA9IHRoaXMuZG9FdmFsKGFsbENvZGUpOwogICAgfSBjYXRjaCAoZSkgewogICAgICAgIC8vIG1vemlsbGEgc2hvd3Mgc29tZS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CkgKyAiIGlzIG5vdCBhIERlZmVycmVkISIpOwogICAgfQogICAgaW50ZXJwcmV0ZXJNYW5hZ2VyLmJsb2NrT24oZCk7Cn07Cgp3aW5kb3cuZGlyID0gZnVuY3Rpb24gKG8pIHsKICAgIC8vIFB5dGhvbiBtdXNjbGUgbWVtb3J5IQogICAgcmV0dXJuIHNvcnRlZChrZXlzKG8pKTsKfTsKCndpbmRvdy5pbnNwZWN0ID0gZnVuY3Rpb24gKG8pIHsKICAgIHdpbmRvdy5fID0gbzsKICAgIGlmICgodHlwZW9mKG8pICE9ICJmdW5jdGlvbiIgJiYgdHlwZW9mKG8pICE9ICJvYmplY3QiKSB8fCBvID09IG51bGwpIHsKICAgICAgICB3aW5kb3cud3JpdGVsbihyZXByKG8pKTsKICAgICAgICByZXR1cm47CiAgICB9CiAgICB2YXIgcGFpcnMgPSBpdGVtcyhvKTsKICAgIGlmIChwYWlycy5sZW5ndGggPT0gMCkgewogICAgICAgIHdpbmRvdy53cml0ZWxuKHJlcHIobykpOwogICAgICAgIHJldHVybjsKICAgIH0KICAgIHdpbmRvdy53cml0ZWxuKFRBQkxFKHsiYm9yZGVyIjogIjEifSwKICAgICAgICBUSEVBRCh7ImNsYXNzIjogImludmlzaWJsZSJ9LCBUUihudWxsLCBURCgpLCBURCgpKSksCiAgICAgICAgVEZPT1QoeyJjbGFzcyI6ICJpbnZpc2libGUifSwgVFIobnVsbCwgVEQoKSwgVEQoKSkpLAogICAgICAgIFRCT0RZKG51bGwsCiAgICAgICAgICAgIG1hcCgKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChrdikgewogICAgICAgICAgICAgICAgICAgIHZhciBjbGljayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5pbnNwZWN0KGt2WzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ZXJwcmV0ZXJNYW5hZ2VyLnNob3dFcnJvcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBUUihudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBURChudWxsLCBBKHtocmVmOiAiIyIsIG9uY2xpY2s6IGNsaWNrfSwga3ZbMF0pKSwKICAgICAgICAgICAgICAgICAgICAgICAgVEQobnVsbCwgcmVwcihrdlsxXSkpCiAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwYWlycwogICAgICAgICAgICApCiAgICAgICAgKQogICAgKSk7Cn07CiAgICAKaW50ZXJwcmV0ZXJNYW5hZ2VyID0gbmV3IEludGVycHJldGVyTWFuYWdlcigpOwphZGRMb2FkRXZlbnQoaW50ZXJwcmV0ZXJNYW5hZ2VyLmluaXRpYWxpemUpOwoKLy8gcmV3cml0ZSB0aGUgdmlldy1zb3VyY2UgbGlua3MKYWRkTG9hZEV2ZW50KGZ1bmN0aW9uICgpIHsKICAgIHZhciBlbGVtcyA9IGdldEVsZW1lbnRzQnlUYWdBbmRDbGFzc05hbWUoIkEiLCAidmlldy1zb3VyY2UiKTsKICAgIHZhciBwYWdlID0gImludGVycHJldGVyLyI7CiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGVsZW1zLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgdmFyIGVsZW0gPSBlbGVtc1tpXTsKICAgICAgICB2YXIgaHJlZiA9IGVsZW0uaHJlZi5zcGxpdCgvXC8vKS5wb3AoKTsKICAgICAgICBlbGVtLnRhcmdldCA9ICJfYmxhbmsiOwogICAgICAgIGVsZW0uaHJlZiA9ICIuLi92aWV3LXNvdXJjZS92aWV3LXNvdXJjZS5odG1sIyIgKyBwYWdlICsgaHJlZjsKICAgIH0KfSk7""")